import Vue from 'vue'
import ELEMENT from 'element-ui'
import App from './App'
import router from 'src/router/admin-router'
import 'src/assets/main.less'
import store from 'src/store/admin-store'
import {common} from 'src/service/common'
import AdminService from "../../../service/admin";

Vue.use(ELEMENT, {size: 'small'});

router.afterEach((to, from) => {
  if (store.state.errorMessage != null) {
    setTimeout(function () {
      ELEMENT.Message({
        message: store.state.errorMessage,
        type: 'error'
      })
      store.commit("errorMessage", null);
    }, 200);
  }
});
common.app(function () {
  AdminService.webInfo().then(ds => {
    store.commit("webInfo", ds.datas[0]);
    const vue = new Vue({
      el: '#app',
      store: store,
      router,
      template: '<App/>',
      components: {App}
    })
    common.vue = vue;
    return vue;
  })
}).then(function (v) {
  console.info('如果需要系统请联系 QQ:35107793')
});

